﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace MishraReader.Windows.Controls
{

    public class HtmlViewer : Control
    {


        public ICommand NavigatedCommand
        {
            get { return (ICommand)GetValue(NavigatedCommandProperty); }
            set { SetValue(NavigatedCommandProperty, value); }
        }



        public ICommand NavigatingCommand
        {
            get { return (ICommand)GetValue(NavigatingCommandProperty); }
            set { SetValue(NavigatingCommandProperty, value); }
        }

        // Using a DependencyProperty as the backing store for NavigatingCommand.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty NavigatingCommandProperty =
            DependencyProperty.Register("NavigatingCommand", typeof(ICommand), typeof(HtmlViewer), new UIPropertyMetadata(null));

        

        public bool OpenLinksExternally
        {
            get { return (bool)GetValue(OpenLinksExternallyProperty); }
            set { SetValue(OpenLinksExternallyProperty, value); }
        }

        // Using a DependencyProperty as the backing store for OpenLinksExternally.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty OpenLinksExternallyProperty =
            DependencyProperty.Register("OpenLinksExternally", typeof(bool), typeof(HtmlViewer), new UIPropertyMetadata(true));

        

        // Using a DependencyProperty as the backing store for NavigatedCommand.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty NavigatedCommandProperty =
            DependencyProperty.Register("NavigatedCommand", typeof(ICommand), typeof(HtmlViewer), new UIPropertyMetadata(null));

        
        public string HtmlString
        {
            get { return (string)GetValue(HtmlStringProperty); }
            set { SetValue(HtmlStringProperty, value); }
        }

        // Using a DependencyProperty as the backing store for HtmlString.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty HtmlStringProperty =
            DependencyProperty.Register("HtmlString", typeof(string), typeof(HtmlViewer), new UIPropertyMetadata(null));


        static HtmlViewer()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(HtmlViewer), new FrameworkPropertyMetadata(typeof(HtmlViewer)));
        }

        //private WebBrowser _browser;
        //public override void OnApplyTemplate()
        //{
        //    _browser = (WebBrowser)GetTemplateChild("PART_browser");
        //    base.OnApplyTemplate();
        //}
    }
}
